package com.linkage.educloud.ah.bean;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Mr'Tang on 2018/12/19.
 */

public class EduAppBean {
    private String appname;// 应用名称
    private long appid;// 应用id
    private String apply;// 应用适用对象，用”,”分割，最多4个
    private String sign;// 标签，用”,”分割
    private int usernum;// 使用人数
    private int isfree;// 是否免费应用 0 免费 ， 1 收费
    private int price;// 应用价格
    private String unit;// 计费单位,月\次等
    private String supplier;// 服务提供商
    private int isorder;// 是否订购 1 订购，0 未订购
    private int isrenew;// 是否可续订，1 可续订，0不可续订
    private int skipway;//跳转方式 0--进应用详情   1--直接进h5
    private String url;//跳转地址
    private int istrytouse;//是否在体验期 1 是 0 否


    public static List<EduAppBean> parseFromJson(JSONArray array) {
        List<EduAppBean> list = new ArrayList<EduAppBean>();
        for (int i = 0; i < array.length(); i++) {
            EduAppBean bean = new EduAppBean();
            JSONObject jsonObj = array.optJSONObject(i);
            bean.setAppname(jsonObj.optString("appname"));
            bean.setAppid(jsonObj.optLong("appid"));
            bean.setApply(jsonObj.optString("apply"));
            bean.setSign(jsonObj.optString("sign"));
            bean.setUsernum(jsonObj.optInt("usernum"));
            bean.setIsfree(jsonObj.optInt("isfree"));
            bean.setPrice(jsonObj.optInt("price"));
            bean.setUnit(jsonObj.optString("unit"));
            bean.setSupplier(jsonObj.optString("supplier"));
            bean.setIsorder(jsonObj.optInt("isorder"));
            bean.setIsrenew(jsonObj.optInt("isrenew"));
            bean.setSkipway(jsonObj.optInt("skipway"));
            bean.setUrl(jsonObj.optString("url"));
            bean.setIstrytouse(jsonObj.optInt("istrytouse"));
            list.add(bean);
        }
        return list;
    }

    public int getIstrytouse() {
        return istrytouse;
    }

    public void setIstrytouse(int istrytouse) {
        this.istrytouse = istrytouse;
    }

    public int getSkipway() {
        return skipway;
    }

    public void setSkipway(int skipway) {
        this.skipway = skipway;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getAppname() {
        return appname;
    }

    public void setAppname(String appname) {
        this.appname = appname;
    }

    public long getAppid() {
        return appid;
    }

    public void setAppid(long appid) {
        this.appid = appid;
    }

    public String getApply() {
        return apply;
    }

    public void setApply(String apply) {
        this.apply = apply;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public int getUsernum() {
        return usernum;
    }

    public void setUsernum(int usernum) {
        this.usernum = usernum;
    }

    public int getIsfree() {
        return isfree;
    }

    public void setIsfree(int isfree) {
        this.isfree = isfree;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getSupplier() {
        return supplier;
    }

    public void setSupplier(String supplier) {
        this.supplier = supplier;
    }

    public int getIsorder() {
        return isorder;
    }

    public void setIsorder(int isorder) {
        this.isorder = isorder;
    }

    public int getIsrenew() {
        return isrenew;
    }

    public void setIsrenew(int isrenew) {
        this.isrenew = isrenew;
    }
}
